import java.util.ArrayList;

public class FunctionCase2 implements Function{

    @Override
    public void PrintInformation(ArrayList<Student> students) {
        int male = 0;
        for (int i = 0; i < students.size(); i++) {
            if (students.get(i).getSex() == '男'){
                male++;
            }
            System.out.println(students.get(i).toString());
        }
        System.out.println("男生一共有："+ male +" "+" 女生一共有："+(students.size()-male));
    }

    @Override
    public void PrintAverageScore(ArrayList<Student> students) {
        double grade = 0;
        double max = students.get(0).getScore();
        double min = students.get(0).getScore();
        for (int i = 0; i < students.size(); i++) {
            if (max < students.get(i).getScore()){
                max = students.get(i).getScore();
            } else if (min > students.get(i).getScore()) {
                min = students.get(i).getScore();
            }
            grade += students.get(i).getScore();
        }
        grade = grade-max-min;
        System.out.println("班级的平均分为："+ (grade/(students.size()-2)));
    }
}
